package com.ebao.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * @desc 让浏览器缓存CSS、JS等静态文件
 * @author snow
 * @date 2012-6-20
 */
public class StaticResourceFilter implements Filter {

	@Override
	public void destroy() {

	}

	/*
	 * http://ganqing.iteye.com/blog/451828
	 * https://sites.google.com/site/wisedukb/Home/response-expire-header
	 * http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
	 */
	@Override
	public void doFilter(final ServletRequest request, final ServletResponse response,
			final FilterChain chain) throws IOException, ServletException {
		
		// add expire head.  
//        response.setHeader("Cache-Control", );  
//        response.setDateHeader("Expires", ); 
		
		// Last-Modified/If-Modified-Since
		
        chain.doFilter(request, response);  
		
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {

	}

}
